<template>
    <div class="main">
        <div class="list-header">邀请记录</div>
        <el-table
            :data="tableData"
            border
            style="width: 100%">
            <el-table-column
            prop="date"
            label="头像"
            width="180">
                <template slot-scope="scope">
                    <img style="width:30px;height:30px;border-radius:50%;" :src="scope.row.headimgurl" alt="">
                </template>
            </el-table-column>
            <el-table-column
            prop="nickname"
            label="昵称"
            width="180">
            </el-table-column>
            <el-table-column
            prop="address"
            label="注册时间">
                <template slot-scope="scope">
                    {{formatDate(scope.row.create_time)}}
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import { myInviteList } from "@/api/index.js";
import { mapGetters } from "vuex";
export default {
    data(){
        return {
            tableData:[],
            data:{
                sid:'',
                time:'',
                theme_id:1,
                rank_type:1
            }
        }
    },
    computed:{
        ...mapGetters(['sid'])
    },
    created(){
        if(process.client) {
            this.data.sid = this.sid;
            this.getList();
        }
    },
    methods:{
        getList(){
            myInviteList(this.data).then(res => {
                // console.log(res);
                this.tableData = res.infor.invite_users
            })
        },
        formatDate(timeStamp){
            if(timeStamp == 0){
                return this.$dayjs().format("YYYY-MM-DD HH:mm:ss");
            }else{
                return this.$dayjs(timeStamp*1000).format("YYYY-MM-DD HH:mm:ss");
            }
        }
    }
}
</script>

<style lang='less' scoped>
 .main{
     width: 1000px;
     margin: 0 auto;
    //  padding-top: 100px;
 }
.list-header{
    padding-top: 20px;
    padding-bottom: 10px;
}
</style>